from  typing import List


class Solution:
    def jump(self, nums: List[int]) -> int:
        jumps = 0  # 跳跃次数
        current_end = 0  # 当前跳可达最远位置
        farthest = 0  # 下一跳可达最远位置

        for i in range(len(nums) - 1):
            farthest = max(farthest, i + nums[i])
            if i == current_end:  # 到达当前跳边界
                jumps += 1
                current_end = farthest
        return jumps